﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div class="fr-widget">
    <div class="fr-widget-header">
        Roles Manage
    </div>
    <div class="collapse-panel">
        <%using (Html.BeginForm("RoleSave", "Admin", FormMethod.Post, new { @id = "ForumF", @onRequest = "$.MvcForum.showLoading()", @onSuccess = "$.MvcForum.hideLoading()" }))
          {%>
        <%=Html.AntiForgeryTokenX("ROLESAVE")%>
        <input type="hidden" id="RoleId" name="RoleId" value="0" />
        <table cellpadding="0" cellspacing="8" width="100%">
            <tr>
                <td class="width50">
                    Role Name
                </td>
                <td>
                    <input type="text" class="input {validate:{required:true}}" name="RoleName" id="RoleName" />
                </td>
            </tr>
            <tr>
                <td>
                    CssClass
                </td>
                <td>
                    <input type="text" class="input {validate:{required:true}}" name="CssClass" id="CssClass" />
                </td>
            </tr>
            <tr>
                <td>
                    IsAutoStart
                </td>
                <td>
                    <input type="checkbox" name="IsAutoStart" id="IsAutoStart" /><label for="IsAutoStart">IsAutoStart</label>
                </td>
            </tr>
            <tr>
                <td>
                    IsAdmin
                </td>
                <td>
                    <input type="checkbox" name="IsAdmin" id="IsAdmin" /><label for="IsAdmin">IsAdmin</label>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>Post Options</strong>
                </td>
            </tr>
            <tr>
                <td>
                    Allow Priority
                </td>
                <td>
                    <input type="checkbox" name="AllowPriority" id="AllowPriority" />
                </td>
            </tr>
            <tr>
                <td>
                    Can post new topics?
                </td>
                <td>
                    <input type="checkbox" name="PostNewTopics" id="PostNewTopics" />
                </td>
            </tr>
            <tr>
                <td>
                    Can post replies to topics?
                </td>
                <td>
                    <input type="checkbox" name="PostReplyToTopics" id="PostReplyToTopics" />
                </td>
            </tr>
            <tr>
                <td>
                    Can post new polls?
                </td>
                <td>
                    <input type="checkbox" name="PostNewPolls" id="PostNewPolls" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Maximum poll answers:</strong><br />
                    Maximum number of answers that can be included within a poll. If answers exceed
                    this limit they will simply be removed.
                </td>
                <td>
                    <input type="text" value="10" class="input {validate:{required:true,digits:true}}"
                        name="MaxPollAnswers" id="MaxPollAnswers" />
                </td>
            </tr>
            <tr>
                <td>
                    Can post replies to polls?
                </td>
                <td>
                    <input type="checkbox" name="PostReplyPolls" id="PostReplyPolls" />
                </td>
            </tr>
            <tr>
                <td>
                    Can vote within polls?
                </td>
                <td>
                    <input type="checkbox" name="VoteWithinPolls" id="VoteWithinPolls" />
                </td>
            </tr>
            <tr>
                <td>
                    Can post (if available) within closed forums?
                </td>
                <td>
                    <input type="checkbox" name="PostWithinLockedForums" id="PostWithinLockedForums" />
                </td>
            </tr>
            <tr>
                <td>
                    Can post (if available) within closed topics?
                </td>
                <td>
                    <input type="checkbox" name="PostWithinLockedTopics" id="PostWithinLockedTopics" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>Edit Options</strong>
                </td>
            </tr>
            <tr>
                <td>
                    Can edit own topics?
                </td>
                <td>
                    <input type="checkbox" name="EditOwnTopics" id="EditOwnTopics" />
                </td>
            </tr>
            <tr>
                <td>
                    Can edit own posts?
                </td>
                <td>
                    <input type="checkbox" name="EditOwnPosts" id="EditOwnPosts" />
                </td>
            </tr>
            <tr>
                <td>
                    Can edit other members topics?
                </td>
                <td>
                    <input type="checkbox" name="EditOtherMembersTopics" id="EditOtherMembersTopics" />
                </td>
            </tr>
            <tr>
                <td>
                    Can edit other members posts?
                </td>
                <td>
                    <input type="checkbox" name="EditOtherMembersPosts" id="EditOtherMembersPosts" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Can view last edited by label?</strong><br />
                    If 'Yes' edit information will be shown below posts.
                </td>
                <td>
                    <input type="checkbox" name="ViewLastEditedByLabel" id="ViewLastEditedByLabel" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Update last edited by details?</strong><br />
                    If 'Yes' when a post is edited information about who edited that post is stored
                    in the database.
                </td>
                <td>
                    <input type="checkbox" name="UpdateLastEditedBy" id="UpdateLastEditedBy" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    Delete Options
                </td>
            </tr>
            <tr>
                <td>
                    Can delete own topics?
                </td>
                <td>
                    <input type="checkbox" name="DeleteOwnTopics" id="DeleteOwnTopics" />
                </td>
            </tr>
            <tr>
                <td>
                    Can delete own posts?
                </td>
                <td>
                    <input type="checkbox" name="DeleteOwnPosts" id="DeleteOwnPosts" />
                </td>
            </tr>
            <tr>
                <td>
                    Can delete other members topics?
                </td>
                <td>
                    <input type="checkbox" name="DeleteOtherMembersTopics" id="DeleteOtherMembersTopics" />
                </td>
            </tr>
            <tr>
                <td>
                    Can delete other members posts?
                </td>
                <td>
                    <input type="checkbox" name="DeleteOtherMembersPosts" id="DeleteOtherMembersPosts" />
                </td>
            </tr>
            <%--  <tr>
                <td colspan="2">
                    Topics & Forum Access Options
                </td>
            </tr>
            <tr>
                <td>
                    Can read forums?
                </td>
                <td>
                    <input type="radio" name="AllowReadForums" id="AllowReadForumsYes" /><label class="radio-yes"
                        for="AllowReadForumsYes">Yes</label><input type="radio" name="AllowReadForums" id="AllowReadForumsNo" /><label
                            class="radio-no" for="AllowReadForumsNo">No</label>
                </td>
            </tr>
            <tr>
                <td>
                    Can read topics?
                </td>
                <td>
                    <input type="radio" name="AllowReadTopics" id="AllowReadTopicsYes" /><label class="radio-yes"
                        for="AllowReadTopicsYes">Yes</label><input type="radio" name="AllowReadTopics" id="AllowReadTopicsNo" /><label
                            class="radio-no" for="AllowReadTopicsNo">No</label>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Can send topics via email? (if enabled)</strong><br />
                    E-mail's must be enabled for this feature to work. See email options towards the
                    bottom of this page.
                </td>
                <td>
                    <input type="radio" name="SendTopicsViaEmail" id="SendTopicsViaEmailYes" /><label
                        class="radio-yes" for="SendTopicsViaEmailYes">Yes</label><input type="radio" name="SendTopicsViaEmail"
                            id="SendTopicsViaEmailNo" /><label class="radio-no" for="SendTopicsViaEmailNo">No</label>
                </td>
            </tr>
            --%>
            <tr>
                <td colspan="2">
                    Moderation Options
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Always moderate posts? </strong>
                    <br />
                    If 'Yes' posts or edits will always be placed into the moderation queue for approval.
                </td>
                <td>
                    <input type="checkbox" name="AlwaysPostAprroved" id="AlwaysPostAprroved" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Moderate edited posts?</strong>
                    <br />
                    If 'Yes' any edited posts will be placed into the moderation queue and will require
                    moderator approval.
                </td>
                <td>
                    <input type="checkbox" name="QueueEdited" id="QueueEdited" />
                </td>
            </tr>
            <%-- <tr>
                <td>
                    <strong>Send Post Approved E-mail's?</strong>
                    <br />
                    If 'Yes' an email notification will be sent to the original post author whenever
                    a post is approved (made visible) from the moderation queue.
                </td>
                <td>
                    <input type="radio" name="EmailNotificationApproved" id="EmailNotificationApprovedYes" /><label
                        class="radio-yes" for="EmailNotificationApprovedYes">Yes</label><input type="radio"
                            name="EmailNotificationApproved" id="EmailNotificationApprovedNo" /><label class="radio-no"
                                for="EmailNotificationApprovedNo">No</label>
                </td>
            </tr>--%>
            <tr>
                <td colspan="2">
                    <strong>Attachment Options</strong>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Maximum Upload Storage?</strong><br />
                    The maximum space available for post and private message attachments. Leave as 0
                    bytes to completely disable attachment uploading.
                </td>
                <td>
                    <input type="text" value="0" id="UploadSize" name="UploadSize" class="input {validate:{required:true,digits:true}}"
                        style="width: 100px" />
                    Kb
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Can download attachments?</strong>
                    <br />
                    If 'No' users will be prompted to login when attempting to download attachments.
                </td>
                <td>
                    <input type="checkbox" name="AllowDownloadAttachments" id="AllowDownloadAttachments" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>Search Options </strong>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Can view search?</strong>
                    <br />
                    If 'No' you can skip the rest of the search settings.
                </td>
                <td>
                    <input type="checkbox" name="ViewSearch" id="ViewSearch" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Maximum number of search results:</strong>
                    <br />
                    Enter the maximum number of results that should be returned for searches. Enter
                    0 to disable any limit.
                </td>
                <td>
                    <input type="text" value="500" id="MaxSearchResults" name="MaxSearchResults" class="input {validate:{required:true,digits:true}}"
                        style="width: 100px" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Maximum search keyword length:</strong>
                    <br />
                    Provide a maximum number of characters users can include within searches. Enter
                    0 to disable any limit.
                </td>
                <td>
                    <input type="text" value="200" id="MaxSearchKeywordLength" name="MaxSearchKeywordLength"
                        class="input {validate:{required:true,digits:true}}" style="width: 100px" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Show results per page:</strong>
                    <br />
                </td>
                <td>
                    <select id="SearchResultsPerPage" name="SearchResultsPerPage">
                        <option value="25">25</option>
                        <option value="30">30</option>
                        <option value="40">40</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>Email Options </strong>
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Can send e-mail's to other members?</strong>
                    <br />
                    If 'Yes' please specify the maximum number of email recipients for each email sent
                    from the board.
                </td>
                <td>
                    <input type="checkbox" name="SendEmails" id="SendEmails" />
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Maximum number of recipients?</strong>
                    <br />
                    Maximum number of email recipients allowed for each email sent from the board. Enter
                    0 to disable limit.
                </td>
                <td>
                    <input type="text" value="0" id="MaxEmailRecipients" name="MaxEmailRecipients" class="input {validate:{required:true,digits:true}}"
                        style="width: 100px" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="button" value="Save" id="_save" onclick="$.MvcForum.ajaxSubmit('ForumF')"
                        class="button" />
                </td>
            </tr>
        </table>
        <%
            }%>
    </div>
</div>
<div class="fr-widget">
    <div class="fr-widget-header">
        Roles List
    </div>
    <div class="collapse-panel">
        <div class="gridview">
            <table class="datatable" cellspacing="0" cellpadding="0" style="width: 100%; border-collapse: collapse;">
                <tr>
                    <th class="header width5" scope="col">
                        <input type='checkbox' onclick='$.MvcForum.toggleCheckbox(this.checked)' />
                    </th>
                    <th class="header" scope="col">
                        Role Name
                    </th>
                    <th class="header" scope="col">
                        Auto Start
                    </th>
                    <th class="header" scope="col">
                        IsAdmin
                    </th>
                    <th class="header" scope="col">
                        Option
                    </th>
                </tr>
                <%
                    var _Roles = RolesRepository.List();


                    foreach (var t in _Roles)
                    {

                %>
                <tr class="row" id="row_<%=t.RoleId%>">
                    <td class="center">
                        <input type="checkbox" value="<%=t.RoleId %>" class="item-selected" />
                    </td>
                    <td>
                        <%=Html.Encode(t.RoleName) %>
                    </td>
                    <td class="center width10">
                        <%=t.IsAutoStart %>
                    </td>
                    <td class="center width10">
                        <%=t.IsAdmin %>
                    </td>
                    <td class="center width8">
                        <a href="javascript:void(0)" onclick="$.MvcForum.loadEdit('forum',<%=t.RoleId %>)">Edit</a>
                    </td>
                </tr>
                <%
}%>
            </table>
        </div>
    </div>
</div>
